package szwolaiyun.paireach.com.szwolaizhuang.model.business;

import android.content.Context;

import com.google.gson.annotations.SerializedName;
import com.paireach.szwolaiyun.sz_util.SharedPreferencesUtil;

import java.io.Serializable;

public class User implements Serializable {

    @SerializedName("id")
    private String id;
    @SerializedName("name")
    private String userName;
    @SerializedName("tel")
    private String phoneNumber;
    @SerializedName("idCard")
    private String idCard;
    @SerializedName("driverCardUrl")
    private String userLogo;

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getUserLogo() {
        return userLogo;
    }

    public void setUserLogo(String userLogo) {
        this.userLogo = userLogo;
    }

    public static void saveUserInfo(Context mContext, User user) {
        SharedPreferencesUtil.setValue(mContext, SharedPreferencesUtil.USER_NAME, user.getUserName());
        SharedPreferencesUtil.setValue(mContext, SharedPreferencesUtil.USER_PHONE, user.getPhoneNumber());
        SharedPreferencesUtil.setValue(mContext, SharedPreferencesUtil.ICON, user.getUserLogo());
        SharedPreferencesUtil.setValue(mContext, SharedPreferencesUtil.ID_CARD, user.getIdCard());
        SharedPreferencesUtil.setValue(mContext, SharedPreferencesUtil.ID, user.getIdCard());

    }

    public static User readUserInfo(Context mContext) {
        User user = new User();
        user.setUserName(SharedPreferencesUtil.getValue(mContext, SharedPreferencesUtil.USER_NAME));
        user.setPhoneNumber(SharedPreferencesUtil.getValue(mContext, SharedPreferencesUtil.USER_PHONE));
        user.setUserLogo(SharedPreferencesUtil.getValue(mContext, SharedPreferencesUtil.ICON));
        user.setIdCard(SharedPreferencesUtil.getValue(mContext, SharedPreferencesUtil.ID_CARD));
        user.setId(SharedPreferencesUtil.getValue(mContext, SharedPreferencesUtil.ID));
        return user;
    }

}
